package cn.edu.zafu.bigdata.liuwenyi;

import java.util.HashMap;

class StudentGradeManager {
    private HashMap<String, Integer> studentGrades;

    public StudentGradeManager(){
        studentGrades = new HashMap<>();
    }

    public void addStudent(String name, int grade){
        studentGrades.put(name, grade);
    }

    public int getGrade(String name) {
        return studentGrades.getOrDefault(name, -1);
    }

    public void removeStudent(String name){
        studentGrades.remove(name);
    }
}
public class StudentGradeManager_Test {
    public static void main(String[] args) {
        StudentGradeManager manager = new StudentGradeManager();

        manager.addStudent("Sohee", 100);
        manager.addStudent("Lwy",99);
        manager.addStudent("Shoator",99);

        System.out.println("Sohee's grade is " + manager.getGrade("Sohee") );
        System.out.println("Lwy's grade is " + manager.getGrade("Lwy"));
        System.out.println("Shoator's grade is " + manager.getGrade("Shoator"));
        System.out.println("Yyn's grade is " + manager.getGrade("Yyn"));

        manager.removeStudent("Shoator");
        System.out.println("After removing Shoator, Shoator's grade is " + manager.getGrade("Shoator"));
    }
}
